*******************************************************************************
* Specify city and years
*******************************************************************************

local city = "fort_worth"

use dataset_`city'_cross, clear

local y1 2009
local y2 2014
local y3 2020

*******************************************************************************
* Ref support and percent black
*******************************************************************************

foreach year in `y1' `y2' `y3' {
	
	#delimit;
	
	gr tw
		(sc turnout pctnhblack if year == `year' [aw=registeredvoters], 
			msym(Oh) msize(tiny) col(gray))
		(lpoly turnout pctnhblack if year == `year'
			[aw=registeredvoters], lcol(black) lwid(thick))
		,
			legend(off)
			plotregion(style(none))
			ylab(, angle(horiz))
			name(g`year', replace)
			title(`year')
			xtitle("")
			ytitle("")
			scale(2)
			;
			
	#delimit cr
	
	gr close
	
}

gr combine g`y1' g`y2' g`y3', rows(1) xsize(3) ysize(1) ycommon xcommon ///
	b1title("Share Black", size(vlarge)) ///
	l1title("Turnout", size(vlarge)) ///
	imargin(zero)
	
gr export "_output/figure A12 a.pdf", replace

*******************************************************************************
* Ref support and miles from shooting
*******************************************************************************

foreach year in `y1' `y2' `y3' {
	
	#delimit;
	
	gr tw
		(sc turnout distance if year == `year' [aw=registeredvoters], 
			msym(Oh) msize(tiny) col(gray))
		(lpoly turnout distance if year == `year' [aw=registeredvoters], 
			lcol(black) lwid(thick))
		,
			legend(off)
			plotregion(style(none))
			ylab(, angle(horiz))
			name(g`year', replace)
			title(`year')
			xtitle("")
			ytitle("")
			scale(2)
			xscale(reverse)
			;
			
	#delimit cr
	
	gr close
	
}

gr combine g`y1' g`y2' g`y3', rows(1) xsize(3) ysize(1) ycommon xcommon ///
	b1title("Distance to Shooting (Miles)", size(vlarge)) ///
	l1title("Turnout", size(vlarge)) ///
	imargin(zero)
	
gr export "_output/figure A12 b.pdf", replace

*******************************************************************************
* End
*******************************************************************************
